package com.origin.oss.util;

import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.origin.oss.config.QiniuyunConfig;

/**
 * @author origin
 */
public class QiniuyunUtils {

    public static Configuration getCfg(QiniuyunConfig qiniuyunConfig) {
        Region region = null;
        switch (qiniuyunConfig.getKodo().getEndpoint()) {
            case "huadong":
                region = Region.huadong();
                break;
            case "huabei":
                region = Region.huabei();
                break;
            case "beimei":
                region = Region.beimei();
                break;
            case "huanan":
                region = Region.huanan();
                break;
            case "xinjiapo":
            case "dongnanya":
                Region.xinjiapo();
                break;
            default:
        }
        // 构造一个带指定 Region 对象的配置类
        return new Configuration(region);
    }

}
